@extends('admin.main')
@section('content')
    <div class="daohang">
        <ul>
            <li>
                <button type="button" class="am-btn am-btn-default am-radius am-btn-xs">医师管理></button>
            </li>
            <li>
                <button type="button" class="am-btn am-btn-default am-radius am-btn-xs">新增医师
                </button>
            </li>
        </ul>
    </div>
    <div class="admin-biaogelist">
        <div class="listbiaoti am-cf">
            <ul class="am-icon-flag on"> 新增医师</ul>
        </div>

        <div class="fbneirong">
            <form class="am-form" method="post">
                <div class="am-form-group am-cf">
                    <div class="zuo">上传头像：</div>
                    <div class="you">
                        <img id="pic" src="/avatar/default.gif" style="width: 80px;height: 80px" alt="">
                        <input type="hidden" id="avatar" name="avatar" >
                        <input style="width: 150px;" type="file"   id="uploadImage" accept="image/*" num="1"
                                            onchange="upload(this,'imgs','btns','thumb')"/>

                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">医师姓名：</div>
                    <div class="you" style="width:200px">
                        <input name="name" type="text" class="am-input-sm"  placeholder="请输入医师姓名">
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">职务：</div>
                    <div class="you" style="width:200px">
                        <input name="job" type="text" class="am-input-sm"  placeholder=" 如: 主任/副主任">
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">职称：</div>
                    <div class="you" style="width:200px">
                        <input name="pro_title" type="text" class="am-input-sm" 
                               placeholder="如: 教授/副教授">
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">专家标识：</div>
                    <div class="you" style="width:200px">
                        <input name="pro_tag" type="text" class="am-input-sm"  placeholder="如: 儿童专家；成人专家可不填">
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">所属科室描述：</div>
                    <div class="you" style="width:200px">
                        <input name="depart_desc" type="text" class="am-input-sm"
                               placeholder="如: 口腔科专家/耳鼻喉专家">
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">个性签名：</div>
                    <div class="you">
                        <textarea name="self_sign" class="" rows="2"  placeholder=" 如: 50个字,省着写"></textarea>
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">从业经验：</div>
                    <div class="you" style="width:200px">
                        <input name="work_exp" type="text" class="am-input-sm"  placeholder="如: 30年经验">
                    </div>
                </div>

                <div class="am-form-group am-cf">
                    <div class="zuo">科室分类：</div>
                    <div class="you">
                        <select name="depart_id" id="depart_id"
                                data-am-selected="{btnWidth: 150, btnSize: 'sm', btnStyle: 'default'}"
                                onchange="apidoc(this.value)">
                            @if($departs)
                                @foreach($departs as $v)
                                    <option value="{{$v['id']}}">{{$v['name']}}</option>
                                @endforeach
                            @endif
                        </select>
                    </div>
                </div>


                <div class="am-form-group am-cf">
                    <div class="zuo">原所在单位：</div>
                    <div class="you">
                        <input name="origin_company" type="text" class="am-input-sm" 
                               placeholder="请输入原所在单位">
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">技术专长：</div>
                    <div class="you">
                        <textarea name="tech_desc" class="" rows="2" placeholder="请输入技术专长"></textarea>
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">名医简介：</div>
                    <div class="you">
                        <textarea name="intro" class="" rows="2" placeholder="请输入名医简介"></textarea>
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">咨询时长(分钟)：</div>
                    <div class="you" style="width:100px">
                        <input name="advice_time" type="text" class="am-input-sm" 
                               placeholder="请输入咨询时长">
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">客服咨询绑定：</div>
                    <div class="you" style="width:100px">
                        <select name="customer_service" id="reffer_ke" style="width:150px;height:30px;font-size: 11px;" class="chosen-select" tabindex="7">
                            @if(isset($kefu))
                                @foreach($kefu as $v)
                                  <option value="{{$v['id']}}">{{$v['realname']}}</option>
                                @endforeach
                            @endif
                        </select>
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">咨询价格：</div>
                    <div class="you" style="width:100px">
                        <input name="advice_price" type="text" class="am-input-sm" 
                               placeholder="请输入咨询价格">
                    </div>
                </div>

                <div class="am-form-group am-cf">
                    <div class="zuo">平台医生和his医生的关联:</div>
                    <div class="you" style="width:200px">
                        <select name="reffer_id" id="reffer_id" style="width:150px;height:30px;font-size: 11px;" class="chosen-select" tabindex="7">
                            <option value="0">请选择平台医生</option>
                        </select>
                    </div>
                </div>
                <div class="am-form-group am-cf">
                    <div class="zuo">平台医生挂号类别:</div>
                    <div class="you" style="width: 200px;">
                        <select name="reg_type" id="reg_type" style="width:200px;height:30px;font-size: 11px;" class="chosen-select" tabindex="7">
                            @if($types)
                                @foreach($types as $v)
                                    <option value="{{$v['号类ID']}}">{{$v['号类名称']}}</option>
                                @endforeach
                            @endif
                        </select>
                    </div>
                </div>

                <div class="am-form-group am-cf">
                    <div class="zuo">平台医生挂号类别(VIP):</div>
                    <div class="you" style="width: 200px;">
                        <select name="reg_type_vip" id="reg_type_vip" style="width:200px;height:30px;font-size: 11px;" class="chosen-select" tabindex="7">
                            @if($types)
                                @foreach($types as $v)
                                    <option value="{{$v['号类ID']}}">{{$v['号类名称']}}</option>
                                @endforeach
                            @endif
                        </select>
                    </div>
                </div>

                <div class="am-form-group am-cf">
                    <div class="you" style="margin-left: 11%;">
                        <center>
                            <button type="submit" class="am-btn am-btn-success am-radius">保存并提交</button>
                        </center>
                    </div>
                </div>


            </form>
        </div>
    </div>
    @section('script')
        <script>
            var message = "{{Session::get('message')}}";
            $(window).ready(function () {
                if (message) {
                    layer.msg(message, {
                        time: 3000 //2秒关闭（如果不配置，默认是3秒）
                    });
                }
            });
            function upload(obj) {
                var _self = obj;
                var _this = $(obj);
                var fileReader = new FileReader();
                fileReader.onload = function (e) {
                    if (fileReader.readyState == FileReader.DONE) {
                        $("#pic").attr('src',this.result);
                        $("#avatar").val(this.result);
                    }
                };
                //一次加载多个文件
                var i = 0, src = _self.files;
                fileReader.readAsDataURL(src[i]);
                fileReader.onloadend = function () {
                    i++;
                    if (i < src.length) fileReader.readAsDataURL(src[i]);
                }
            }
            function apidoc(id)
            {
                var url = "{{urlAdmin('doctor','getAjaxDoctors')}}?depart_id="+id;
                $.get(url,function(res){
                    var $select = $('#reffer_id');
                    $select.empty();
                    var str = '';
                    if(res.length > 0) {
                        for(var i=0 ; i<res.length;i++) {
                            str+='<option value="'+res[i].BCE01+'">'+res[i].BCE03+'</option>';
                        }
                    } else {
                        str+='<option value="'+res.BCE01+'">'+res.BCE03+'</option>';
                    }
                    $select.append(str);
                    $select.trigger('chosen:updated');
                });
            }
        </script>
    @endsection
        @include('admin.footer')
@endsection